<?=n_mod('skin')->pageHead("站点配置", array()) ?>
<div class="n-row n-margin-default-top n-margin-default-bottom">
	<label class="n-col-12 n-nopadding" style="text-align:center">
		请选择需要复制的配置规则
	</label>
</div>
<form method="post" action="<?=n_url('nconfig', 'syncSave')?>">
	<table class="a-table a-table-striped">
		<thead>
			<tr>
				<th>
					<div class="a-checkbox">
						<label>
							<input id="checkall" type="checkbox" onclick="toggleCheck()" />

							<input type="hidden" name="scode" value="<?=$data['dest']?>" />
						</label>
					</div>
				</th>
				<th>插件码/配置码</th>
				<th>描述</th>
				<th>值</th>
			</tr>
		</thead>
		<tbody>
		<?php
		if (! empty($data['srcConf'])) :
			foreach ($data['srcConf'] as $key => $val) :
		?>
		<tr>
			<td>
				<div class="a-checkbox">
					<label>
						<input class="ids" type="checkbox" name="ids[]" value="<?=$val['id']?>" />
					</label>
				</div>
			</td>
			<td><?="{$val['pevent']}/{$val['ckey']}"?></td>
			<td><?=$val['descript']?></td>
			<td><?=$val['value']?></td>
		</tr>
		<?php
			endforeach;
		else :
		?>
		<tr>
			<td colspan="4">暂无配置数据</td>
		</tr>
		</tbody>
	<?php
	endif;
	?>
	</table>
	<div class="n-col-4 n-nopadding n-margin-default-top">
		<div class="a-form">
			<button type="submit" class="a-button-green">
				<i class="fa fa-2x fa-save" style="color:#fff;"></i>
			</button>
		</div>
	</div>
</form>
<div class="n-col-2 n-nopadding n-margin-default-top n-padding-default-left">
	<button class="a-button-default">
		<?php
		$url = n_url('nconfig', 'index');
		?>
		<a target="_self" href="<?=$url?>">
			<i class="fa fa-2x fa-remove" style="display:block;"></i>
		</a>
	</button>
</div>
<script>
	function toggleCheck() {
		if ($('#checkall').prop('checked')) {
			$('.ids').prop('checked',true);
		}
		else {
			$('.ids').prop('checked',false);
		}
	}
</script>
